Skip to main content
Plugins / Gitea Create Pull Request

Gitea Create Pull Request

by JohnWalkerx

Plugin to create a new pull request on a Gitea/Forgejo repo.


Woodpecker CI plugin to create new pull requests on a Gitea/Forgejo repo.

It lets you create a new PR of a specified branch and can trigger an automerge of the PR.

If a PR for the specified branch already exists it skip the PR creation. So you can create workflows for e.g. update dependencies with a automated PR workflow.

You'll need to generate an Gitea/Forgejo API token for authentification.

NOTE: The option delete_branch_after_merge doesn't work in combination with automerge due to this issue in Forgejo/Gitea. So the branch won't get deleted after a merge. On the next run it creates an empty PR because the branch still exists but with no diff to the main branch.

As a workaround for this issue the option close_pr_if_empty and delete_branch_if_pr_empty is useful.

Settings

Settings Name Default Description
gitea_address none Address of the Gitea/Forgejo instance
gitea_token none API token for authentification on Gitea/Forgejo instance
owner none Owner of the repo owner
repo none Repository name
branch none Branch name for which you wanna create a PR
base_branch none Name of the base branch you want to merge into
pr_title none Title of the PR
pr_body none Body content of the PR
skip_on_missing_branch false Skip PR creation if branch don't exist. Otherwise return with failure.
close_pr_if_empty false Close PR if there is no difference between branch and base_branch
delete_branch_if_pr_empty false Delete branch if there is no difference between branch und base_branch
merge_when_checks_succeed false Automerge branch when all specified checks succeeded successful
delete_branch_after_merge false Delete branch after PR got merged automatically

Example

steps:
  create-pr:
    image: johnwalkerx/gitea-pull-request-create-plugin:latest
    pull: true
    settings:
      gitea_address: https://codeberg.org
      gitea_token:
        from_secret: token
      owner: ${CI_REPO_OWNER}
      repo: ${CI_REPO_NAME}
      branch: ${CI_COMMIT_BRANCH}
      base_branch: main
      pr_title: My pull request title
      pr_body: PR automatically created by Woodpecker CI
      skip_on_missing_branch: true
      close_pr_if_empty: true
      delete_branch_if_pr_empty: true
      merge_when_checks_succeed: true
      delete_branch_after_merge: true